//
//  WQCSetPasswordViewController.m
//  renxinghuan
//
//  Created by 王晓民 on 2018/4/9.
//  Copyright © 2018年 吴清翠. All rights reserved.
//

#import "WQCSetPasswordViewController.h"
#import "configuration.h"
#import "SetGestureLockViewController.h"
#import "WQCSetPassController.h"
#import "WYCZhifusetController.h"
#import "WQCBankViewController.h"
@interface WQCSetPasswordViewController ()<UITableViewDelegate,UITableViewDataSource>
@property(nonatomic,strong)UITableView  *setTablleView;
@property(nonatomic,strong)NSArray  *titleSource;
@end

@implementation WQCSetPasswordViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setupNav];
    [self setupTableView];

    if (@available(iOS 11.0, *)) {
        self.setTablleView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
    }else{
    if ([self respondsToSelector:@selector(automaticallyAdjustsScrollViewInsets)]) {
        self.automaticallyAdjustsScrollViewInsets = NO;
    }
    }
}
#pragma make -------->>TableView
- (void)setupTableView{
    NSLog(@"%f",NavHeight);
    self.setTablleView = [[UITableView alloc] initWithFrame:CGRectMake(0,NavHeight + 28, ScreenWidth,  ScreenHeight) style:UITableViewStylePlain];
    self.setTablleView.dataSource = self;
 //   self.automaticallyAdjustsScrollViewInsets = NO;
    self.setTablleView.delegate = self;
    self.setTablleView.scrollEnabled = NO;
    self.setTablleView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;//分割线
    self.setTablleView.tableFooterView = [[UIView alloc]init];
    [self.view addSubview:self.setTablleView];
    
    _titleSource = @[@"登录密码",@"交易密码",@"手势密码"];
}
- (void)setupNav
{
    self.navigationItem.title = @"密码管理";
    [self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor]}];
    [self.navigationController.navigationBar setBarTintColor:wycMain];
    
    self.view.backgroundColor = WYCGlobalBg;
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}
#pragma mark tableViewDelegate
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    //分组数 也就是section数
    return 1;
}

//设置每个分组下tableview的行数
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 3;
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 50;
}

//设置每行对应的cell（展示的内容）
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *identifer=@"cell";
    UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:identifer];
    if (cell==nil) {
        cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifer];
    }
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;

    [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
    cell.textLabel.font = [UIFont systemFontOfSize:15];
    cell.textLabel.text = [_titleSource objectAtIndex:indexPath.row];
  
    return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.row == 0 ) {
        WQCBankViewController  *payView = [[WQCBankViewController alloc]init];
        payView.myFlag = @"888";
        [self.navigationController pushViewController:payView animated:YES];
    }
    else if (indexPath.row ==1)
    {
        WQCBankViewController  *payView = [[WQCBankViewController alloc]init];
        payView.myFlag = @"999";

        [self.navigationController pushViewController:payView animated:YES];
    }
    else if (indexPath.row == 2)
    {
        SetGestureLockViewController  *lockView = [[SetGestureLockViewController alloc]init];
        [self.navigationController pushViewController:lockView animated:YES];
    }
}
@end
